package com.wngbms._01_bytecode;

public class ForLoopTest {

    private static int[] numbers = {1, 3, 6};
    
    public static void main(String[] args) {
        MovingAverage ma = new MovingAverage();
        for (int num : numbers) {
            ma.submit(num);
        }
        double avg = ma.getAvg();
    }
}

/**
 * PS D:\Code\_01_geektime\_01_geektime> javap -c .\bin\com\wngbms\ForLoopTest.class
Compiled from "ForLoopTest.java"
public class com.wngbms.ForLoopTest {
  static {};
    Code:
       0: iconst_3
       1: newarray       int
       3: dup
       4: iconst_0
       5: iconst_1
       6: iastore
       7: dup
       8: iconst_1
       9: iconst_3
      10: iastore
      11: dup
      12: iconst_2
      13: bipush        6
      15: iastore
      16: putstatic     #10                 // Field numbers:[I
      19: return

  public com.wngbms.ForLoopTest();
    Code:
       0: aload_0
       1: invokespecial #15                 // Method java/lang/Object."<init>":()V
       4: return

  public static void main(java.lang.String[]);
    Code:
       0: new           #21                 // class com/wngbms/MovingAverage
       3: dup
       4: invokespecial #23                 // Method com/wngbms/MovingAverage."<init>":()V
       7: astore_1
       8: getstatic     #10                 // Field numbers:[I
      11: dup
      12: astore        5
      14: arraylength
      15: istore        4
      17: iconst_0
      18: istore_3
      19: goto          36
      22: aload         5
      24: iload_3
      25: iaload
      26: istore_2
      27: aload_1
      28: iload_2
      29: i2d
      30: invokevirtual #24                 // Method com/wngbms/MovingAverage.submit:(D)V
      33: iinc          3, 1
      36: iload_3
      37: iload         4
      39: if_icmplt     22
      42: aload_1
      43: invokevirtual #28                 // Method com/wngbms/MovingAverage.getAvg:()D
      46: dstore_2
      47: return
}
 */